package com.hyjx.framework.service;

import com.hyjx.framework.common.util.SpringBeanUtil;
import com.hyjx.framework.service.cache.ICache;

/**
 * 基础缓存服务
 *
 * @author dijian
 */
public class CacheService {
    private static final ICache cache;
    
    static {
        String config = ConfigManager.getConfig("hyjx.cache.type", "baseCache");
        cache = (ICache) SpringBeanUtil.getBean(config);
    }
    
    /**
     * 设置缓存对象
     *
     * @param key
     * @param value
     */
    public static void set(String key, Object value) {
        cache.set(key, value);
    }
    
    /**
     * 获取缓存对象
     *
     * @param key
     */
    public static Object get(String key) {
        Object obj = cache.get(key);
        return obj;
    }
    
    /**
     * 移除缓存对象
     *
     * @param key
     */
    public static void remove(String key) {
        cache.remove(key);
    }
}